package it.softphone.cmc.maven;

import it.softphone.cmc.impl.ScriptletServiceClientImpl;
import it.softphone.cmc.shared.entity.Asset;

import org.apache.maven.plugins.annotations.Parameter;

public abstract class AbstractScriptletQueryMojo extends AbstractScriptletMojo {

	//@MojoParameter(required=false,expression="${groupId}")
	@Parameter(required=false,property="groupId")
	private String groupId = "";

	//@MojoParameter(required=false,expression="${artifactId}")
	@Parameter(required=false,property="artifactId")
	private String artifactId;
	
	//@MojoParameter(required=false,expression="${version}")
	@Parameter(required=false,property="version")
	private String version;

	protected final String getGroupId() {
		return groupId;
	}

	protected final void setGroupId(String groupId) {
		this.groupId = groupId;
	}

	protected final String getArtifactId() {
		return artifactId;
	}

	protected final void setArtifactId(String artifactId) {
		this.artifactId = artifactId;
	}

	protected final String getVersion() {
		return version;
	}

	protected final void setVersion(String version) {
		this.version = version;
	}
	
	protected Asset makeAssetFromParameter( ScriptletServiceClientImpl service) {
		
		Asset filter = service.makeAsset();
		
		filter.setArtifactId(artifactId);
		filter.setGroupId(groupId);
		filter.setVersion(version);

		return filter;
	}

}
